package com.base.service;

import java.io.Serializable;
import java.util.List;

import com.base.dao.IBaseDao;

public class BaseServiceImpl<T,PK extends Serializable> implements IBaseService<T,PK> {
	
	private IBaseDao<T,PK> baseDao;
	
	public void setBaseDao(IBaseDao<T,PK> baseDao) {
		this.baseDao = baseDao;
	}


	@Override
	public void save(T o) {
		baseDao.save(o);		
	}	

	@Override
	public void delete(PK id) {
		baseDao.delete(id);		
	}

	@Override
	public void update(T o) {
		baseDao.update(o);
	}
	
	@Override
	public void saveOrUpdate(T o) {
		baseDao.saveOrUpdate(o);
		
	}
	
	@Override
	public T get(PK id) {
		return (T)baseDao.get(id);
	}
	
	@Override
	public List<T> getAll() {
		return baseDao.getAll();
	}

	@Override
	public List<T> getAll(String hql) {
		return  baseDao.getAll(hql);
	}

	@Override
	public List<T> getAll(String hql, int page, int rows) {
		return baseDao.getAll(hql, page, rows);
	}

	@Override
	public int count(String hql) {
		return baseDao.count(hql);
	}
}
